package cw.spring.security.acl.poc.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.NotNull;

/**
 * Used to store the last run of stardust feeding tools (MACAO, Markit...)
 * 
 * @author montagnoncy
 * 
 */
@Entity
@Table(name = "GroupAuthority")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class GroupAuthorityModel {

  private long id;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  private String authority;
  private NorthGroupModel northGroup;

  @ManyToOne
  @JoinColumn(name = "group_id", nullable = false)
  @NotNull
  public NorthGroupModel getNorthGroup() {
    return northGroup;
  }

  public void setNorthGroup(NorthGroupModel northGroup) {
    this.northGroup = northGroup;
  }


  @NotNull
  public String getAuthority() {
    return authority;
  }

  public void setAuthority(String authority) {
    this.authority = authority;
  }

}
